package com.cyj.dream.admin.service.system.impl;

import com.cyj.dream.admin.model.system.SysRole;
import com.cyj.dream.admin.model.system.SysUserRole;
import com.cyj.dream.admin.persistence.manager.systems.SysUserRoleManager;
import com.cyj.dream.admin.service.system.SysUserRoleService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Set;

/**
 * @Description: 用户角色关联关系服务实现类
 * @BelongsProject: dream-DreamChardonnay
 * @BelongsPackage: com.dream.DreamChardonnay.service.impl
 * @Author: ChenYongJia
 * @CreateTime: 2021-05-17 09:30
 * @Email: chen87647213@163.com
 * @Version: 1.0
 */
@Slf4j
@Service
public class SysUserRoleServiceImpl implements SysUserRoleService {

    @Autowired
    private SysUserRoleManager sysUserRoleManager;

    /**
     * 查询用户关联关系表
     *
     * @param sysUserRole 用户关联关系对象
     * @return java.util.List<com.dream.DreamChardonnay.model.system.SysUserRole>
     * @date 2021/5/17 9:55
     * @author ChenYongJia
     * @version 1.0
     */
    @Override
    public List<SysUserRole> selectSysUserRoleList(SysUserRole sysUserRole) {
        return sysUserRoleManager.selectSysUserRoleList(sysUserRole);
    }

    /**
     * 获取所有用户信息
     *
     * @return java.util.List<SysRole>
     * @date 2021/6/9 21:01
     * @author ChenYongJia
     * @version 1.0
     */
    @Override
    public List<SysRole> getRoleLists(){
        return sysUserRoleManager.getRoleLists();
    }

    /**
     * 为用户设置角色
     *
     * @param sysUserId 用户id
     * @param sysRoleId 角色id集合
     * @return boolean
     * @date 2021-5-17 09:48:34
     * @author ChenYongJia
     * @version 1.0
     */
    @Override
    public boolean settingSysUserRole(Long sysUserId, Set<Long> sysRoleId) {
        return sysUserRoleManager.settingSysUserRole(sysUserId, sysRoleId);
    }

    /**
     * 为用户移除设置的角色
     *
     * @param sysUserId 用户id
     * @param sysRoleId 角色id集合
     * @return boolean
     * @date 2021-5-17 09:48:34
     * @author ChenYongJia
     * @version 1.0
     */
    @Override
    public boolean deleteSysUserRole(Long sysUserId, Set<Long> sysRoleId) {
        return sysUserRoleManager.deleteSysUserRole(sysUserId, sysRoleId);
    }

}
